using UnityEngine;
using UnityEngine.UI;

namespace Demo2048
{
    public class Info : MonoBehaviour
    {
        private void Awake()
        {
            Transform c = transform.Find("Score/Value");
            score = c.GetComponent<Text>();

            c = transform.Find("Step/Value");
            step = c.GetComponent<Text>();
        }

        int Step
        {
            set
            {
                step.text = value.ToString();
                stepVal = value;
            }

            get
            {
                return stepVal;
            }
        }

        int Score
        {
            set
            {
                score.text = value.ToString();
                scoreVal = value;
            }

            get
            {
                return scoreVal;
            }
        }

        public void Reset()
        {
            Step = 0;
            Score = 0;
        }

        public void incStep()
        {
            Step += 1;
        }

        public void incScore(int step)
        {
            Score += step;
        }

        private Text score;
        private Text step;

        private int scoreVal;
        private int stepVal;
    }
}